﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ninject;

namespace IOCWindows
{
    /// <summary>
    /// Ninject 注册工具类   
    /// </summary>
    public class NinjectIOCfact
    {
        public  static IKernel ninjectKernel { get; } = new StandardKernel();


        public static void register()
        {
            ninjectKernel.Bind<ISay>().To<Say>();
         
        }

        public static T Get<T>() where T : class
        {
            return ninjectKernel.Get<T>();
        }

        public static object Get(Type type)
        {
            try
            {
                return ninjectKernel.Get(type);
            }
            catch
            {
                return null;
            }
        }
    }
}
